#pragma once
#include<iostream>
#define N 10000
using namespace std;
namespace GIS20234
{
	int function(int arr[N])
	{
		int count = 0;
		int i=0,j = 0;
		while (count != N - 1)
		{
			if (arr[j] != -1)
			{
				i++;
				if (i == 3)
				{
					arr[j] = -1;
					count++;
					i = 0;
				}
			}
			j=j%N+1;
		}
		for (int k = 0; k < N; k++)
		{
			if (arr[k] != -1)
				return k + 1;
		}
	}
}